package com.linchong.xshop.dto;

/**
 * @author linchong
 * @desc 店铺信息+状态值码
 * @email littlexbear@163.com
 * @create 2018-07-14 19:04
 * @CopyRight(C) https://blog.csdn.net/littlexbear
 **/

import com.linchong.xshop.entity.Shop;
import com.linchong.xshop.enums.ShopStateEnum;

import java.util.List;

/**
 * DTO的存在就是为了帮助我们减少客户端请求而降低服务器压力，
 * 提升效率。在使用DTO后我们可以灵活定义数据模型，同时将数
 * 据模型和逻辑剥离开了。
 */
public class ShopExecution {

    //结果状态
    private int state;

    //状态的标识
    private String stateInfo;

    //店铺的数量
    private int count;

    //操作的shop(增删改店铺时使用)
    private Shop shop;

    //shop列表(查询店铺列表时使用)
    private List<Shop> shopList;

    public ShopExecution(){

    }

    /**
     * 店铺操作失败时使用的构造器
     * @param stateEnum
     */
    public ShopExecution(ShopStateEnum stateEnum){
        this.state = stateEnum.getState();// 获得整型的状态值
        this.stateInfo = stateEnum.getStateInfo();
    }

    /**
     * 店铺操作成功时使用的构造器，返回一个店铺信息
     * @param stateEnum
     * @param shop
     */
    public ShopExecution(ShopStateEnum stateEnum,Shop shop) {
        this.state = stateEnum.getState();// 获得整型的状态值
        this.stateInfo = stateEnum.getStateInfo();
        this.shop = shop;
    }

    /**
     * 店铺操作成功时使用的构造器，返回多个店铺
     * @param stateEnum
     * @param shopList
     */
    public ShopExecution(ShopStateEnum stateEnum,List<Shop> shopList) {
        this.state = stateEnum.getState();// 获得整型的状态值
        this.stateInfo = stateEnum.getStateInfo();
        this.shopList = shopList;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public Shop getShop() {
        return shop;
    }

    public void setShop(Shop shop) {
        this.shop = shop;
    }

    public List<Shop> getShopList() {
        return shopList;
    }

    public void setShopList(List<Shop> shopList) {
        this.shopList = shopList;
    }
}
